package com.work.cos.mapper.base;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.work.cos.domain.entity.AddressEntity;

public interface IAddressMapper extends BaseMapper<AddressEntity, Long> {
	
	/**
	 * 
	 * 查询所有收货地址
	 * 
	 * @param pageNo 起始页
     * @param pageSize 每页显示多少条
     * @return List<DeliveryAddress>
     */
	List<AddressEntity> findAllPage(@Param("userId") String userId,@Param("currentPage") int currentPage, @Param("pageSize") int pageSize);
    
    /**
     * 通过用户虚拟ID查询收货地址
     * 
     * @param userCode
     * @param currentPage
     * @param pageSize
     * @return
     */
    List<AddressEntity> findAddressByUserId(@Param("userId")String userId);
    
    /**
     * 
     * @param userId
     * @return
     */
    AddressEntity findDefaultAddress(@Param("userId")String userId);
    
    /**
     * 
     * @param entity
     * @return
     */
    int updateAddress(AddressEntity entity);
    
    /**
     * 删除收货地址
     * 
     * @param entity
     * @return
     */
    int delAddress(@Param("id")Long id,@Param("userId") String userId);
    
    /**
     * 设置默认收货地址
     * @param id
     * @param userId
     * @return
     */
    int setDefaultAddress(@Param("id")Long id,@Param("userId")  String userId);
    
    /**
     * 
     * @param userId
     * @return
     */
    int cancelDefaultAddress(@Param("userId")String userId,@Param("id")Long id);
}